home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Sample Code / 7Edit / Pascal Sources / SVEditGlobals.p < prev    next >
Encoding:
Text File  |  1994-02-25  |  5.3 KB  |  230 lines  |  [TEXT/MPS ]

  1. UNIT SVEditGlobals;
  2. (*
  3.     SVEditGlobals.p
  4.     
  5.     Version 3.0d8
  6.     
  7.     Copyright © SRL Data 1992, 1993
  8.     
  9.     All rights reserved
  10.     
  11.     Produced by : SRL Data
  12.     Originally Developed for UK.DTS
  13. *)
  14.  
  15. {
  16.     This example is brought to you for the purposes of exploration and experimentation of
  17.     System 7.0.  It is not intended to form the basis of your own programs- but try out the code-
  18.     that's what it's there for 
  19. }
  20.  
  21. {
  22.     About the data structures-
  23.     SectRecord -:
  24.     this is our own record type used for holding specific information about Publisher
  25.     or Subscriber sections.  A linked list of SectHandles is referenced from the document
  26.     record.  A SectHandle is stored in the refcon field of the Edition Manager section record- the
  27.     same idea as hooking up the document record to the refcon of the WindowRecord.
  28.     
  29.     DocRec -:
  30.     This is used for storing document records containing Font, Size and Style information.
  31.     
  32.     HeaderRec -:
  33.     This is then stored as a 'TFSS' resource (standing for Text Font, Size and Style) which is
  34.     stored in the resource fork of a document file.  It also now includes stuff for storing
  35.     the number of sections in a document and the lastsectionID
  36.  
  37.     New for 3.0d2 :
  38.     
  39.     27-Feb-92 : NH : Add comment, zap test menu stuff, 
  40.                      remove unneeded constants, 
  41.                      move others to SVEditWindow.p, zap gCurrSection
  42.                      
  43.     Changes for 3.0d4 :
  44.     
  45.      3-Jul-92 : NH : Remove kAEAskUser
  46.                      Remove kAEYes,kAENo - now in AERegistry.h
  47.      5-Aug-92 : NH : Added SVEditAppSig, gNewDocCount
  48.                      
  49.     Changes for 3.0d5 :
  50.     
  51.     21-Aug-92 : NH : Added everSaved, gNewDocCount
  52. }
  53.  
  54. INTERFACE
  55.  
  56. USES
  57.     MemTypes, QuickDraw, OSIntf, ToolIntf, Traps, Editions, Printing;
  58.  
  59.  
  60.  CONST
  61.  
  62.   WindowID         = 128;
  63.   ErrorAlert     = 256;
  64.   AdviseAlert     = 257;
  65.  
  66.   (*
  67.       Menu Resource IDs
  68.   *)
  69.   appleID     = 128;
  70.   fileID     = 129;
  71.   editID     = 130;
  72.   fontID     = 131;
  73.   sizeID     = 132;
  74.   styleID   = 133;
  75.   
  76.   kLastID     = 133;
  77.  
  78.   (*
  79.       Items in Apple Menu
  80.   *)
  81.   aboutItem = 1;
  82.   
  83.   (*
  84.       Items in File Menu
  85.   *)
  86.   fmNew         = 1;
  87.   fmOpen         = 2;
  88.   fmClose         = 4;
  89.   fmSave         = 5;
  90.   fmSaveAs         = 6;
  91.   fmRevert         = 7;
  92.   fmPageSetUp     = 9;
  93.   fmPrint         = 10;
  94.   fmQuit         = 12;
  95.   
  96.   (*
  97.       Items in Edit Menu
  98.   *)
  99.   undoCommand         = 1;
  100.   cutCommand         = 3;
  101.   copyCommand         = 4;
  102.   pasteCommand         = 5;
  103.   clearCommand         = 6;
  104.   selectAllCommand     = 7;
  105.   
  106.   cPublisher           = 9;
  107.   cSubscriber          = 10;
  108.   cOptions             = 11;
  109.   cBorders             = 12;
  110.  
  111.   (*
  112.       Items in Style Menu
  113.   *)
  114.   cPlain         = 1;
  115.   cBold         = 2;
  116.   cItalic         = 3;
  117.   cUnderline     = 4;
  118.   cOutline         = 5;
  119.   cShadow         = 6;
  120.   cCondense     = 7;
  121.   cExtend         = 8;
  122.  
  123.   (*
  124.       Entry of Menu in myMenus
  125.   *)
  126.   appleM     = 0;
  127.   fileM     = 1;
  128.   editM     = 2;
  129.   fontM     = 3;
  130.   sizeM     = 4;
  131.   styleM     = 5;
  132.   kLastMenu    = 5;
  133.  
  134.   (*
  135.       Save Changes Dialog Items
  136.   *)
  137.   aaSave     = 1;
  138.   aaDiscard = 2;
  139.   aaCancel     = 3;
  140.  
  141.   kOSEvent                = app4Evt;    {event used by MultiFinder}
  142.   kSuspendResumeMessage    = 1;        {high byte of suspend/resume event message}
  143.   kResumeMask            = 1;        {bit of message field for resume vs. suspend}
  144.   kMouseMovedMessage    = $FA;        {high byte of mouse-moved event message}
  145.   kNoEvents                = 0;        {no events mask}
  146.  
  147.  TYPE
  148.  
  149.  {Forward decl - Shuts Compiler Up}
  150.  
  151.   DHandle = ^DPtr;
  152.   DPtr = ^DocRec;
  153.   
  154.  {this is a section record to hold the information about the publishers and subscribers}
  155.  {in this document}  
  156.   
  157.   SectHandle = ^SectPtr;
  158.   SectPtr = ^SectRec;
  159.   SectRec = RECORD
  160.     fSectHandle   : SectionHandle;
  161.     fSectionID    : INTEGER;
  162.     fBorderRgn    : RgnHandle; {handle to the outside border}
  163.     fInnerBounds  : RECT;
  164.     fStart        : INTEGER;  {fStart and fEnd are both specific to a}
  165.     fEnd          : INTEGER;  {text handling application- start and end of text selection}
  166.     fNextSection  : SectHandle;
  167.     fFSSpec       : FSSpec;
  168.     fCount        : INTEGER;
  169.     fTextHandle   : Handle;
  170.     fChanged      : BOOLEAN; {has the section been changed}
  171.     fDocument     : DPtr;
  172.    END;                          
  173.  
  174.   DocRec = record
  175.     theText        : TEHandle;
  176.     vscrollBar     : ControlHandle;
  177.     hscrollBar     : ControlHandle;
  178.     theWindow      : WindowPtr;
  179.     dirty          : BOOLEAN;
  180.     refNum         : INTEGER;
  181.     theFont        : INTEGER;
  182.     theSize        : INTEGER;
  183.     theStyle       : STYLE;
  184.     theFileName    : STR255;
  185.     firstSection   : SectHandle; {the first section in the list}
  186.     lastSection    : SectHandle; {the last section}
  187.     numSections    : INTEGER;
  188.     theFSSpec      : FSSpec;
  189.     lastID         : INTEGER; {the last sectionID}
  190.     thePrintSetup  : THPrint;
  191.     pageSize       : Rect;    {From thePrintSetUp^^.prInfo.rPage but 0 offset}
  192.     showBorders    : BOOLEAN;
  193.     everSaved      : BOOLEAN;
  194.    end;
  195.  
  196.   HHandle = ^HPtr;
  197.   HPtr = ^HeaderRec;
  198.   headerRec = record
  199.     theFont     : STR255; {stored as a FontName}
  200.     theSize     : INTEGER;
  201.     theStyle    : Style;
  202.     theLength   : INTEGER;
  203.     numSections : INTEGER;
  204.     lastID      : INTEGER;
  205.    end;
  206.  
  207.  var
  208.  
  209.   gWCount         : INTEGER;
  210.   gNewDocCount    : INTEGER;
  211.   myMenus         : Array[AppleM..KLastMenu] of MenuHandle;
  212.   gFontMItem      : INTEGER;
  213.   gQuitting       : BOOLEAN;
  214.   editCursor      : Cursor;
  215.   waitCursor      : Cursor;
  216.   gInBackground   : BOOLEAN;
  217.   
  218.   {now for the environment variables set up by Gestalt}
  219.   
  220.   gGestaltAvailable           : BOOLEAN;
  221.   gAppleEventsImplemented     : BOOLEAN;
  222.   gAliasManagerImplemented    : BOOLEAN;
  223.   gEditionManagerImplemented  : BOOLEAN;
  224.   gOutlineFontsImplemented    : BOOLEAN;
  225.   gRecordingImplemented       : BOOLEAN;
  226.  
  227.  
  228. IMPLEMENTATION
  229.  
  230. END.